var player : GameObject;
var view : changeView;
static var cam : int;

function Awake()
{	
	// set the variable view to the changeView script found on the Player GameObject
	view = GameObject.Find("pCharacter").GetComponent(changeView);
	
	// set sCamera to that of the startCamera in the changeView Script
	cam = view.startCamera;
}	
	
function FixedUpdate()
{
	// Get an update of which is the active camera in this frame
	cam = view.startCamera;
		
	// Check if in 2D
	// Set the players local Z scale to make the capsule thin
	if(cam == 1 && player.transform.localScale.z != 0.2)	// 2D scale
		player.transform.localScale.z = 0.2;

	// Check the Player's Yaw is not zero in 2D (carried over from 3D perspective)
	// Then change it to zero if it isn't (so when 2D the Player Rot is in it's correct position)
	if(cam == 1 && player.transform.localRotation.y != 0)
		player.transform.localRotation.y = 0;
	
	// Check that the Player's Z-axis position is not -16.67599 (Puts the player on the edge of the 2D platforms)
	// Then change it to -16.67599 if it isn't (i.e. the Player was moved into the Z-axis when in 3D)
	if(cam == 1 && player.transform.localPosition.z != -16.67599)
		player.transform.localPosition.z = -16.67599;

	// Check if in 3D
	// Set the players local Z scale to make the capsule thick
	if((cam == 2 || cam == 3) && player.transform.localScale.z != 0.8)	// 3D scale
		player.transform.localScale.z = 0.8;
}
